#include "03_ThreadPool.h"
#include "04_MyTask.h"

#define LOG_WHERE() \
    std::clog << "[DEBUG] " << __FILE__ << ":" << __LINE__ << " (" << __FUNCTION__ << ")\n"

void test(){
    // 1: 创建线程池
    LOG_WHERE();
    ThreadPool pool(4, 10);

    // 3: 开始线程池
    LOG_WHERE();
    pool.start();
    
    // 2: 创建对象
    LOG_WHERE();
    for(int i = 0; i < 20; ++i)
    {
        pool.addTask(new MyTask(i));
    }

    // 4: 停止线程池
    LOG_WHERE();
    pool.stop();
}

int main()
{
    test();
    return 0;
}

